﻿Imports System.Collections.ObjectModel
Imports FuncClasses
Imports System.Windows.Controls
Imports System.Windows.Media.Imaging

Public Class DHLControl
    Public Event RefreshRequested()

    Public Sub SetDetails(ByVal values As Collection(Of KeyValuePairs))
        StackPanelDetails.Children.Clear()
        StackPanelDetails.Children.Add(GridDetailHeader)
        For Each kvp As KeyValuePairs In values
            Dim g As New Grid
            g.Height = 28
            '### Datum - Ort - Text ###'
            'Add Controls with the Content
            Dim l1 As New Label()
            l1.Margin = New Windows.Thickness(6, 0, 0, 0)
            l1.Content = kvp.Key

            Dim l2 As New Label()
            l2.Margin = New Windows.Thickness(145, 0, 0, 0)
            l2.Content = kvp.Value

            Dim l3 As New Label()
            l3.Margin = New Windows.Thickness(244, 0, 6, 0)
            l3.Content = kvp.Others(0)

            g.Children.Add(l1)
            g.Children.Add(l2)
            g.Children.Add(l3)
            StackPanelDetails.Children.Add(g)
            Expander1.IsExpanded = True
        Next
    End Sub

    Public Sub SetLastState(ByVal kvp As KeyValuePairs)
        Label11.Content = kvp.Key 'Produkt
        Label12.Content = kvp.Value 'Letzter Status
        Label13.Content = kvp.Others(0) 'Empfänger
    End Sub

    Public Sub SetImages(bImage1 As Boolean, bImage2 As Boolean, bImage3 As Boolean, bImage4 As Boolean, bImage5 As Boolean)
        If bImage1 Then
            Image1.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/post1ena.png"))
            Image2.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/trennena.png"))
        Else

        End If

        If bImage2 Then
            Image3.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/post2ena.png"))
            Image4.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/trennena.png"))
        Else

        End If

        If bImage3 Then
            Image5.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/post3ena.png"))
            Image6.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/trennena.png"))
        Else

        End If

        If bImage4 Then
            Image7.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/post4ena.png"))
            Image8.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/trennena.png"))
        Else

        End If

        If bImage5 Then
            Image9.Source = New BitmapImage(New Uri("pack://application:,,,/PacketTracking;component/Images/post5ena.png"))
        Else

        End If
    End Sub
End Class
